package com.bjsxt.service.impl;

import com.bjsxt.mapper.AdminMapper;
import com.bjsxt.pojo.Admin;
import com.bjsxt.pojo.PageA;
import com.bjsxt.service.AdminService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin findOneAdmin(String aname, String apwd) {
        return adminMapper.selectOneAdmin(aname, apwd);
    }

    @Override
    public PageA<Admin> findAllAdmin(Integer page, Integer rows) {
        Page pg = PageHelper.startPage(page, rows);
        List<Admin> admins = adminMapper.selectAllAdmin();
        PageA<Admin> pga = new PageA<>(admins,pg.getTotal());
        return pga;
    }
}
